<?php


namespace Yond\LaravelDomain\Console\App;

use Yond\LaravelDomain\Console\AppGenerator;

class QueryMakeCommand extends AppGenerator
{

    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'yond:domain:query {--model= : The name of model to make migration}
                                              {--domain= : The name of domain has the model}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Make a domain query builder';

    protected function getUserInputs(): array
    {
        $model = ucfirst($this->optionOrAsk('model', 'Please enter the name of model to make query'));
        $domain = ucfirst($this->optionOrAsk('domain', 'Please enter the name of domain has the model'));

        return [
            'path' => [
                'app' => $this->sectionName ? $this->appName.'/'.$this->sectionName : $this->appName,
                'file' => $model.'Query',
            ],
            'stub' => [
                'app' => $this->sectionName ? $this->appName.'\\'.$this->sectionName : $this->appName,
                'class' => $model.'Query',
                'model' => $model,
                'domain' => $domain,
            ],
        ];
    }

    protected function getStubName(): string
    {
        return 'query.stub';
    }

    protected function getPathStructure(): string
    {
        return 'app/{app}/Queries/{file}.php';
    }
}
